package cn.calm.swing.osgi.file.close;

import java.util.Hashtable;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

import cn.calm.swing.osgi.api.MenuService;
import cn.calm.swing.osgi.file.close.ui.CloseMenuService;

public class Activator implements BundleActivator{
	private ServiceRegistration<MenuService> register;

	@Override
	public void start(BundleContext context) throws Exception {
		Hashtable<String, String> para = new Hashtable<String, String>();
		para.put(MenuService.MENU_TREE, "file/close");
		MenuService service = new CloseMenuService();
		register = context.registerService(MenuService.class, service, para);
	}

	@Override
	public void stop(BundleContext context) throws Exception {
		if (register != null) {
			register.unregister();
			register = null;
		}
	}
}
